package com.quanyan.alipay.config;

import org.apache.commons.lang3.StringUtils;

/**
 * @author songzj
 * @date 16/7/4-16:18
 */
public class AlipayConfig {


    public String partner;
    public String private_key;
    public String ali_public_key;

    public String getOpen_public_key() {
        return open_public_key;
    }

    public String open_public_key;
    public String input_charset = "UTF-8";
    public String sign_type = "RSA";
    public String seller;
    public String key;
    public String notify_url;
    public String refund_notify_url;
    public String withdraw_notify_url;

    public String getApp_id() {
        return app_id;
    }

    public String app_id;

    public AlipayConfig(Builder builder) {
        this.partner = builder.partner;
        this.private_key = builder.private_key;
        this.ali_public_key = builder.ali_public_key;
        this.open_public_key = builder.open_public_key;
        this.seller = builder.seller;
        this.key = builder.key;
        this.notify_url = builder.notify_url;
        this.refund_notify_url = builder.refund_notify_url;
        this.withdraw_notify_url = builder.withdraw_notify_url;
        this.app_id=builder.app_id;
        if (!StringUtils.isEmpty(builder.sign_type)) {
            this.sign_type = builder.sign_type;
        }
        if (!StringUtils.isEmpty(builder.input_charset)) {
            this.input_charset = builder.input_charset;
        }
    }

    public String getPartner() {
        return partner;
    }

    public String getPrivate_key() {
        return private_key;
    }

    public String getAli_public_key() {
        return ali_public_key;
    }

    public String getInput_charset() {
        return input_charset;
    }

    public String getSign_type() {
        return sign_type;
    }

    public String getSeller() {
        return seller;
    }

    public String getKey() {
        return key;
    }

    public String getNotify_url() {
        return notify_url;
    }

    public String getRefund_notify_url() {
        return refund_notify_url;
    }

    public String getWithdraw_notify_url() {
        return withdraw_notify_url;
    }

    public static class Builder {
        public String partner;
        public String private_key;
        public String ali_public_key;
        public String input_charset;
        public String sign_type;
        public String seller;
        public String key;
        public String notify_url;
        public String refund_notify_url;
        public String withdraw_notify_url;
        public String app_id;
        public String open_public_key;

        public Builder setOpen_public_key(String open_public_key) {
            this.open_public_key = open_public_key;
            return this;
        }

        public Builder setApp_id(String app_id) {
            this.app_id = app_id;
            return this;
        }

        public String getSign_type() {
            return sign_type;
        }

        public Builder setSign_type(String sign_type) {
            this.sign_type = sign_type;
            return this;
        }

        public Builder setPartner(String partner) {
            this.partner = partner;
            return this;
        }

        public Builder setPrivate_key(String private_key) {
            this.private_key = private_key;
            return this;
        }

        public Builder setAli_public_key(String ali_public_key) {
            this.ali_public_key = ali_public_key;
            return this;
        }

        public Builder setSeller(String seller) {
            this.seller = seller;
            return this;
        }

        public Builder setKey(String key) {
            this.key = key;
            return this;
        }

        public Builder setNotify_url(String notify_url) {
            this.notify_url = notify_url;
            return this;
        }

        public Builder setRefund_notify_url(String refund_notify_url) {
            this.refund_notify_url = refund_notify_url;
            return this;
        }

        public Builder setWithdraw_notify_url(String withdraw_notify_url) {
            this.withdraw_notify_url = withdraw_notify_url;
            return this;
        }

        public AlipayConfig build() {
            return new AlipayConfig(this);
        }
    }


}
